﻿//************************************************************************************************
// Copyright © 2012 Steven M. Cohn. All Rights Reserved.
//
//************************************************************************************************

namespace CookieChipper
{
	using System;
	using System.Windows.Forms;


	/// <summary>
	/// Simply provides a base class for forms that can be closed with the Esc key.
	/// </summary>
	
	internal class OptionalForm : Form
	{

		/// <summary>
		/// Allow for an easy escape!  (Yeah, see what I did there? Huh? Huh?)
		/// </summary>
		/// <param name="keyData"></param>
		/// <param name="msg"></param>

		protected override bool ProcessCmdKey (ref Message msg, Keys keyData)
		{
			if (keyData == Keys.Escape)
			{
				this.Close();
				return true;
			}

			return base.ProcessCmdKey(ref msg, keyData);
		}
	}
}
